return function (filename, data, flag)
  if not flag then
    flag = 'w+'
  end

  file.open(filename, flag)
  file.write(data)
  file.close()
end